<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:71:"/www/wwwroot/jiaoyu/public/../application/index/view/article/index.html";i:1585995405;s:61:"/www/wwwroot/jiaoyu/application/index/view/common/header.html";i:1585916506;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php echo $activetype['name']; ?></title>
    <link rel="stylesheet" href="/assets/css/swiper.min.css" />
    <link rel="stylesheet" href="/assets/css/lui.css?version=333" />
    <style>
        .swiper-container {
            width: 100%;
            height: 100%;
        }
        .swiper-slide img {
            vertical-align: bottom;
        }
    </style>
</head>
<body>
<!--swiper start-->
<div class="swiper-container">
    <div class="swiper-wrapper">
        <div class="swiper-slide">
            <img src="<?php echo $category['image']; ?>" />
        </div>
    </div>
</div>
<!--swiper end-->
<!--list start-->
<ol class="news-list">
    <li>
        <?php echo $article['content']; ?>
    </li>
    <li>
        <?php echo $article['tsinfo']; ?>
    </li>
</ol>
<!--list end-->
<!--page start-->
<div class="page" data-url="<?php echo url('index/article/index',['id'=>$article['category_id'],'articleid'=>$article['id']]); ?>">

    <?php if(($flag == 8)): ?>
    <span class="btn next" data-url="<?php echo url('index/article/index',['id'=>$sarticle[0]['category_id'],'articleid'=>$sarticle[0]['id']]); ?>">上一页</span>

    <?php if(!(empty($banner['dzlink']) || (($banner['dzlink'] instanceof \think\Collection || $banner['dzlink'] instanceof \think\Paginator ) && $banner['dzlink']->isEmpty()))): ?>
    <span class="btn load" data-url="<?php echo $banner['dzlink']; ?>"><a href="javascript:void(0);" target="_blank">下载电子版</a></span>
    <?php endif; ?>

    <span class="btn next" data-url="<?php echo url('index/article/index',['id'=>$xarticle[0]['category_id'],'articleid'=>$xarticle[0]['id']]); ?>">下一页</span>

    <?php elseif(($flag == 2)): ?>
    <span class="btn">上一页</span>

    <?php if(!(empty($banner['dzlink']) || (($banner['dzlink'] instanceof \think\Collection || $banner['dzlink'] instanceof \think\Paginator ) && $banner['dzlink']->isEmpty()))): ?>
    <span class="btn load" data-url="<?php echo $banner['dzlink']; ?>"><a href="javascript:void(0);" target="_blank">下载电子版</a></span>
    <?php endif; ?>

    <span class="btn next" data-url="<?php echo url('index/article/index',['id'=>$xarticle[0]['category_id'],'articleid'=>$xarticle[0]['id']]); ?>">下一页</span>

    <?php elseif(($flag == 1)): ?>
    <span class="btn next" data-url="<?php echo url('index/article/index',['id'=>$sarticle[0]['category_id'],'articleid'=>$sarticle[0]['id']]); ?>">上一页</span>

    <?php if(!(empty($banner['dzlink']) || (($banner['dzlink'] instanceof \think\Collection || $banner['dzlink'] instanceof \think\Paginator ) && $banner['dzlink']->isEmpty()))): ?>
    <!--<span class="btn load" data-url="<?php echo $banner['dzlink']; ?>"><a href="javascript:void(0);" target="_blank">下载电子版</a></span>-->
    <?php endif; ?>

    <!--<span class="btn">下一页</span>-->
    <span class="btn next" data-url="<?php echo url('index/index/index',['cate'=>$cate]); ?>">返回首页</span>
    <?php else: ?>
    <span class="btn">上一页</span>

    <?php if(!(empty($banner['dzlink']) || (($banner['dzlink'] instanceof \think\Collection || $banner['dzlink'] instanceof \think\Paginator ) && $banner['dzlink']->isEmpty()))): ?>
    <!--<span class="btn load" data-url="<?php echo $banner['dzlink']; ?>"><a href="javascript:void(0);" target="_blank">下载电子版</a></span>-->
    <?php endif; ?>

    <!--<span class="btn">下一页</span>-->
    <span class="btn next" data-url="<?php echo url('index/index/index',['cate'=>$cate]); ?>">返回首页</span>
    <?php endif; ?>


</div>
<!--page end-->
<!--share start-->
<div id="myshare" style="position: fixed; left: 0; top: 0; right: 0; height: 100%; z-index: 999; padding: 50px; text-align: right; background: rgba(0,0,0,.5);display: none" data-cate="<?php echo $cate; ?>">
    <img src="/assets/img/tips.png?version=333" width="200" />
</div>
<!--share end-->

<script src="/assets/js/jquery.min.js"></script>
<script src="/assets/js/swiper.min.js"></script>
<script type="text/javascript">
    //localStorage.removeItem('old_wechat_open_id_new');
    //localStorage.removeItem('old_wechat_token');
</script>

<script type="text/javascript">

    function empty(obj) {
        if (obj=='undefined') {
            return true;
        }
        if (obj === null) return true;
        if (typeof obj === 'undefined') {
            return true;
        }
        if (typeof obj === 'string') {
            if (obj === "") {
                return true;
            }
            var reg = new RegExp("^([ ]+)|([　]+)$");
            return reg.test(obj);
        }
        if(obj==0){
            return true;
        }

        return false;
    }
    var host = window.location.protocol+"//"+window.location.host+'/'+'index/article/index';
    var redirect_url = encodeURIComponent(host);
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }
    if (String(getQueryString('code')) == 'null'&&empty(localStorage.getItem('old_wechat_open_id_new'))) {
        window.location.href = '/index/index/getbase?redirect_url='+redirect_url;
    }
    var bt_open_id = localStorage.getItem('old_wechat_open_id_new')
    if (empty(bt_open_id) || bt_open_id =='undefined') {
        $.ajax({
            url: '/index/index/getopenid',
            type: "post",
            async: false,
            data: {
                code: getQueryString('code')
            },
            success: function(e) {
                e = JSON.parse(e)
                localStorage.setItem('old_wechat_open_id_new', e.data.openid)
                localStorage.setItem('old_wechat_token', e.data.token)
                isFollow(e.data.openid)
            }
        })
    }


    function isFollow(open_id) {
        //是否关注公众号
        $.ajax({
            url: '/index/index/isflow',
            type: "post",
            async: false,
            data: {
                openid: open_id
            },
            success: function(e) {

                e = JSON.parse(e);
                // alert(e.data.isFollow)
                if (e.data.isFollow == 0) {
                    location.href = '/index/index/index?source=article';
                } else {
                    is_share_flg = 1;
                }
            }
        })
    }


    var global_is_follow = 0;
    var tzurl = $(this).attr('data-url');
    //是否关注公众号
    $.ajax({
        url: '/index/index/isflow',
        type: "post",
        async: false,
        data: {
            openid: localStorage.getItem('old_wechat_open_id_new')
        },
        success: function(e) {
            e = JSON.parse(e);
            if (e.data.isFollow == 0 ||empty(e.data.isFollow)) {
                global_is_follow = 0;
                location.href = '/index/index/index?source=article';
            } else {
                //去查看网页内容
                global_is_follow = 1;
                return false;
            }


        }
    })
    if (global_is_follow==0) {
        location.href = '/index/index/index?source=article';
    }



</script>
<script type="text/javascript" src='http://res.wx.qq.com/open/js/jweixin-1.2.0.js'></script>
<script type="text/javascript">

    $(function () {
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: "<?php echo $signpackage['appId']; ?>", // 必填，公众号的唯一标识
            timestamp: "<?php echo $signpackage['timestamp']; ?>", // 必填，生成签名的时间戳
            nonceStr: "<?php echo $signpackage['nonceStr']; ?>", // 必填，生成签名的随机串
            signature: "<?php echo $signpackage['signature']; ?>",// 必填，签名
            jsApiList: [
                'onMenuShareTimeline',
                'onMenuShareAppMessage',
            ]
        });
        $('.next').click(function () {
            var url = $(this).attr('data-url');
            if($(this).html()=='返回首页'){
                location.href = url;
            }
            $.ajax({
                url:'/index/article/isshare',
                type:'post',
                data:{
                    openid: localStorage.getItem('old_wechat_open_id_new'),
                    activetype_id:"<?php echo $cate; ?>",
                    share_type:1
                },
                dataType:'json',
                success:function(res){
                    //alert(res.code);
                    if(res.code==1){
                        $('#myshare').css('display','block');
                        //点击分享
                        if((localStorage.getItem('fenxiang'))==null){

                        }
                        wx.ready(function () {
                            var shareData = {
                                //标题
                                title: "<?php echo $myshare['name']; ?>",
                                //摘要
                                desc: "<?php echo $myshare['description']; ?>",
                                //链接,可以换主页
                                link:"<?php echo $myshare['link']; ?>" ,
                                //缩略图
                                imgUrl: "<?php echo $myshare['image']; ?>",
                                success: function() {
                                    $.ajax({
                                        url:'/index/article/mark',
                                        type:'post',
                                        data:{openid:localStorage.getItem('old_wechat_open_id_new'),token:localStorage.getItem('old_wechat_token'),url:url,cate:"<?php echo $cate; ?>",share_type:1},
                                        dataType:'json',
                                        success:function (res2) {

                                            $('#myshare').css('display','none');
                                            localStorage.setItem('fenxiang', 'yes');
                                            location.href = url;

                                        }
                                    });

                                },
                                fail:function(res){
                                    alert('fail');
                                },
                                cancel: function() {
                                    alert('分享失败');
                                    localStorage.removeItem('fenxiang');
                                    console.log('分享失败1');
                                    $('#myshare').css('display','block');
                                }
                            }

                            wx.onMenuShareTimeline(shareData);
                            wx.onMenuShareAppMessage(shareData);


                        });
                    }else{
                        //var url = $(this).attr('data-url');
                        $('#myshare').css('display','none');
                        location.href = url;
                        /*
                        textTip('今天已经分享过了，明天再来！', 2000, function () {

                        });
                        */
                        return;
                    }
                }
            });

            //alert(localStorage.getItem('fenxiang'));
            /*
            if((localStorage.getItem('fenxiang'))==null){
                $('#myshare').css('display','block');
            }else{
                if((localStorage.getItem('fenxiang'))=='yes'){
                    $('#myshare').css('display','none');
                    location.href = url;
                }

            }
            */
            //alert("<?php echo $myshare['name']; ?>"+'@@@'+"<?php echo $myshare['description']; ?>"+'@@@'+"<?php echo $myshare['link']; ?>"+'@@@'+"<?php echo $myshare['image']; ?>");







        });


        /*
        $('.load').click(function () {
            var url = $(this).attr('data-url');

            $.ajax({
                url:'/index/article/isshare',
                type:'post',
                data:{
                    openid: localStorage.getItem('old_wechat_open_id_new'),
                    activetype_id:"<?php echo $cate; ?>",
                    share_type:2
                },
                dataType:'json',
                success:function(res){
                    //alert(res.code);
                    if(res.code==1){
                        $('#myshare').css('display','block');
                        //点击分享
                        if((localStorage.getItem('fenxiang'))==null){

                        }

                        wx.ready(function () {
                            var shareData = {
                                //标题
                                title: "<?php echo $myshare['name']; ?>",
                                //摘要
                                desc: "<?php echo $myshare['description']; ?>",
                                //链接,可以换主页
                                link:"<?php echo $myshare['link']; ?>" ,
                                //缩略图
                                imgUrl: "<?php echo $myshare['image']; ?>",
                                success: function() {
                                    $.ajax({
                                        url:'/index/article/mark',
                                        type:'post',
                                        data:{openid:localStorage.getItem('old_wechat_open_id_new'),token:localStorage.getItem('old_wechat_token'),url:url,cate:"<?php echo $cate; ?>",share_type:2},
                                        dataType:'json',
                                        success:function (res2) {

                                            $('#myshare').css('display','none');
                                            localStorage.setItem('fenxiang', 'yes');
                                            location.href = url;

                                        }
                                    });

                                },
                                fail:function(res){
                                    alert('fail');
                                },
                                cancel: function() {
                                    alert('分享失败');
                                    localStorage.removeItem('fenxiang');
                                    console.log('分享失败1');
                                    $('#myshare').css('display','block');
                                }
                            }

                            wx.onMenuShareTimeline(shareData);
                            wx.onMenuShareAppMessage(shareData);


                        });
                    }else{
                        //var url = $(this).attr('data-url');
                        $('#myshare').css('display','none');
                        location.href = url;

                        return;
                    }
                }
            });


        });

        */
        $('.load').click(function () {
            var url = $(this).attr('data-url');

            $.ajax({
                url:'/index/article/isshare',
                type:'post',
                data:{
                    openid: localStorage.getItem('old_wechat_open_id_new'),
                    activetype_id:"<?php echo $cate; ?>",
                    share_type:2
                },
                dataType:'json',
                success:function(res){
                    //alert(res.code);
                    if(res.code==1){
                        $.ajax({
                            url:'/index/article/mark',
                            type:'post',
                            data:{openid:localStorage.getItem('old_wechat_open_id_new'),token:localStorage.getItem('old_wechat_token'),url:url,cate:"<?php echo $cate; ?>",share_type:2},
                            dataType:'json',
                            success:function (res2) {
                                $('#myshare').css('display','none');
                                localStorage.setItem('fenxiang', 'yes');
                                location.href = url;

                            }
                        });
                    }else{
                        //var url = $(this).attr('data-url');
                        $('#myshare').css('display','none');
                        location.href = url;

                        return;
                    }
                }
            });


        });



        wx.ready(function () {
            var shareData = {
                //标题
                title: "<?php echo $myshare['name']; ?>",
                //摘要
                desc: "<?php echo $myshare['description']; ?>",
                //链接,可以换主页
                link:"<?php echo $myshare['link']; ?>" ,
                //缩略图
                imgUrl: "<?php echo $myshare['image']; ?>",
                success: function() {
                    $.ajax({
                        url:'/index/article/mark',
                        type:'post',
                            data:{openid:localStorage.getItem('old_wechat_open_id_new'),token:localStorage.getItem('old_wechat_token'),url:$('.page').attr('data-url'),cate:"<?php echo $cate; ?>"},
                        success:function (e) {
                            $('#myshare').css('display','none');
                            localStorage.setItem('fenxiang', 'yes');
                            //location.href = url;
                        }
                    });

                },
                fail:function(res){
                    alert('fail');
                },
                cancel: function() {
                    alert('分享失败');
                    localStorage.removeItem('fenxiang');
                    console.log('分享失败1');
                    $('#myshare').css('display','block');
                }
            };

            wx.onMenuShareTimeline(shareData);
            wx.onMenuShareAppMessage(shareData);


        });






    })

</script>



</body>
</html>
